<form method="post" id="form_term_add">
  <table class="itable itable-color">
    <tr>
      <td width="80px"></td>
      <td id="msg_term_add"></td>
    </tr>
    <tr>
      <td width="80px">分类</td>
      <td>
      <input name="vid" value="<{$vac.vid}>" type="hidden"/><{$vac.name}>
      </td>
    </tr>
    <tr>
      <td width="80px">名称</td>
      <td><input type="text" value="" name="name"/></td>
    </tr>
    
    <tr>
      <td>描述</td>
      <td><textarea name="description"></textarea></td>
    </tr>
    <tr>
      <td>排序</td>
      <td><input type="text" value="0" name="weight"/></td>
    </tr>
    <tr>
      <td>上级术语</td>
      <td>
		<select name="parent" multiple="multiple" style="height:150px;font-size:16px;">
	      	<option value=""><根></option>
	      	<{if $terms}>
	      		<{foreach from=$terms item=t}>
	      			<option value="<{$t.tid}>"><{$t.name}></option>
	      		<{/foreach}>
	      	<{/if}>
      	</select>
		</td>
    </tr>
    <tr>
      <td></td>
      <td><input type="submit" name="submit" value="确认添加" />
      <input type="reset" value="清空" style="display:none;"/></td>
    </tr>
  </table>
</form>

<script type="text/javascript">
$("#form_term_add").submit(function(){
	$.ajax({
		type: "POST",
		url: "admin.php?ctrl=vocabulary&act=term_submit",
		data: $(this).serialize(),
		timeout: 20000,
		error: function(){alert('error');},
		success: function(result){
		  if(result == 'success'){
			  $('#form_term_add input[type="reset"]').trigger('click');
			  $('#msg_term_add').html('添加成功');
		  }else{
			  $('#msg_term_add').html(result);
		  }
		}
	});
	return false;
});

</script>